import request from "@/utils/request";
import type {
  AddOrUpdateSkuParams,
  GetSkuListResponse,
} from "./models/skuModels";

enum Api {
  addSkuUrl = `/admin/product/saveSkuInfo`,
  getSkuListUrl = `/admin/product/list`,
}

/**
 * 添加SKU
 * @param sku AddOrUpdateSkuParams
 * @returns null
 */
export const addSkuApi = (sku: AddOrUpdateSkuParams) => {
  return request.post<any, null>(Api.addSkuUrl, sku);
};

/**
 * 获取SKU列表
 * @param page 当前页码
 * @param limit 每页条数
 * @returns SkuList
 */
export const getSkuListApi = (page: number, limit: number) => {
  return request.get<any, GetSkuListResponse>(
    Api.getSkuListUrl + `/${page}/${limit}`
  );
};
